package com.xmkj.bearuser.home.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.SparseArray;

import com.xmkj.bearuser.home.SearchFragment;

/**
 * Create by leo
 * 创建日期：2018/7/27
 * 描述：
 */

public class SearhPagerAdapter extends FragmentPagerAdapter {
    SparseArray<String> titles;
    Context context;
    public SearhPagerAdapter(FragmentManager fm ,SparseArray<String>titles, Context context ) {
        super(fm);
        this.titles = titles;
        this.context = context;
    }

    @Override
    public Fragment getItem(int position) {
        return new SearchFragment(position+1);
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }
    @Override
    public int getCount() {
        return titles == null ? 0 : titles.size();
    }
}
